<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <title>微信安全支付</title>

	<script type="text/javascript">
		//调用微信JS api 支付
        function jsApiCall(){
            WeixinJSBridge.invoke(
                'getBrandWCPayRequest',
                {$jsApiParameters},
                function(res){
                    //WeixinJSBridge.log(res.err_msg);
                    //alert(res.err_code);return false;
                    //如果支付成功
					//var str = "how are you today";
					//var arr = str.split(" ");
					/*for(var i in res){
						document.write(res[i]);
					}*/
                    if (res.err_msg == 'get_brand_wcpay_request:ok') {
                    	//alert({$vid});
						location.href = "{:url('index/video')}?id={$vid}";//支付成功后跳转的地址
                    }else if (res.err_msg == 'get_brand_wcpay_request:cancel') {
                        //alert('请尽快完成支付哦！');
                    }else if (res.err_msg == 'get_brand_wcpay_request:fail') {
                        alert('支付失败');
                    }else {
                        alert('意外错误');
                    }
                }
            );
        }

        function callpay(){
            if (typeof WeixinJSBridge == "undefined"){
                if( document.addEventListener ){
                    document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                }else if (document.attachEvent){
                    document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
                    document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                }
            }else{
                jsApiCall();
            }
        }
		callpay();
	</script>
</head>
<body>	
	<!-- </br></br></br></br>
	<div align="center">
		<button style="width:210px;height:30px;background-color:#FE6714;border:0px #FE6714 solid;cursor:pointer;color:white;font-size:16px;" type="button" onclick="callpay()">贡献一下</button>
	</div> -->
</body>
</html>